package com.zty.xiaomiadmin.server.Dao;

import com.zty.xiaomiadmin.server.Entity.Order;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface OrderMapper {
    @Select("select hostid,orderNo,statusDesc,createTime,payment,receiverName,receiverMobile,receiverAddress,receiverCity,receiverProvince,receiverZip " +
            "from orde order by orderNo limit #{currPage},#{pageSize}")
    List<Order> getOrders(Map<String, Object> map);

    @Select("select count(*) " +
            "from orde order by orderNo")
    int getOrdersTotal(Map<String, Object> map);

    @Select("select hostid,orderNo,statusDesc,createTime,payment,receiverName,receiverMobile,receiverAddress,receiverCity,receiverProvince,receiverZip " +
            "from orde where statusDesc = #{statusDesc} order by orderNo limit #{currPage},#{pageSize}")
    List<Order> getOrdersByStatusDesc(Map<String, Object> map);

    @Select("select count(*) " +
            "from orde where statusDesc = #{statusDesc} order by orderNo")
    int getOrdersByStatusDescTotal(Map<String, Object> map);

    @Update("update orde set status = 2,statusDesc = '已发货' where orderNo = #{id}")
    void editOrderStatusById(String id);
}
